package com.aso114.project.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.aso114.project.R;
import com.aso114.project.base.BaseApplication;
import com.aso114.project.bean.JingPinBean;
import com.aso114.project.mvp.activity.SelectedTopicPayActivity;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;

public class SelectedTopicPayItemAdapter extends BaseAdapter {
    ArrayList<JingPinBean.PaperList> paperList = new ArrayList<>();
    private Context context;

    public SelectedTopicPayItemAdapter(Context context, ArrayList<JingPinBean.PaperList> paperList) {
        this.context = context;
        this.paperList = paperList;
    }

    @Override
    public int getCount() {
        return paperList.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (convertView != null) {
            holder = (ViewHolder) convertView.getTag();
        } else {
            convertView = LayoutInflater.from(BaseApplication.getInstance().getBaseContext()).inflate(R.layout.adapter_selected_topic_pay_item, parent, false);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        }
        if (position == getCount() - 1) {
            holder.payView1.setVisibility(View.GONE);
        } else {
            holder.payView1.setVisibility(View.VISIBLE);
        }
        holder.payDownTitle1.setText(paperList.get(position).getTitle());
        return convertView;
    }

    static
    class ViewHolder {
        @BindView(R.id.pay_down_title1)
        TextView payDownTitle1;
        @BindView(R.id.pay_down_price1)
        TextView payDownPrice1;
        @BindView(R.id.pay_view1)
        View payView1;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
